package cn.kgc.javaweb.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * @author: mosin
 * @version: v1.0  2022/9/13
 *ServletContextListener  监听应用的上下文对象  application
 */

public class ServletContextScopeListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {// 服务器启动就会被调用
        System.out.println("application对象被创建");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {  // 服务器正常关闭就会被调用
        System.out.println("application对象被销毁");
    }
}
